Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authhelper: Tweak auth report escaping #6212

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kingthorin
Copy link
Member

@kingthorin kingthorin commented Feb 21, 2025

Overview

Ensure output is escaped as expected. Booleans without quotes, strings with inner quotes escaped etc.

Related Issues

n/a

Note: Some of these tests fail on windows, likely due to line ending differences. But work fine via git bash/gradle.

Checklist

  • Update help
  • Update changelog
  • Run ./gradlew spotlessApply for code formatting
  • Write tests
  • Check code coverage
  • Sign-off commits
  • Squash commits
  • Use a descriptive title

@psiinon
Copy link
Member

psiinon commented Feb 21, 2025

Logo
Checkmarx One – Scan Summary & Details892b4a04-14aa-4919-85de-6b9754600d04

Great job, no security vulnerabilities found in this Pull Request

@kingthorin kingthorin force-pushed the auth-rpt-fix branch 6 times, most recently from 9f579dd to d59176c Compare February 21, 2025 19:19
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stats need update too

@kingthorin
Copy link
Member Author

I believe this is as expected now.

ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.systemDefault());
String current = zonedDateTime.format(DateTimeFormatter.RFC_1123_DATE_TIME);
String expected =
"{\n\t\"@programName\": \"ZAP\",\n\t\"@version\": \"Test Build\",\n\t\"@generated\": \"@@@replace@@@\",\n\t\"site\": \"https:\\/\\/www.example.com\"\n\t\n\t,\"summaryItems\": [\n\t\t{\n\t\t\t\"description\": \"Bob's \\\"Item\\\"\",\n\t\t\t\"passed\": true,\n\t\t\t\"key\": \"summary.1\"\n\t\t},\n\t\t{\n\t\t\t\"description\": \"Foo bar\",\n\t\t\t\"passed\": true,\n\t\t\t\"key\": \"summary.\\\"2\\\"\"\n\t\t}\n\t]\n\t\n\t\n\t,\"afEnv\": \" env:\\n contexts:\\n name: 'some \\\"quote\\\" name'\\n\"\n\t\n\t\n\t,\"statistics\": [\n\t\t{\n\t\t\t\"key\": \"stats.auth.1\",\n\t\t\t\"scope\": \"foo \\\"random\\\" bar\",\n\t\t\t\"value\": 123\n\t\t},\n\t\t{\n\t\t\t\"key\": \"stats.foo.oops \\\"foo\\\" bar\",\n\t\t\t\"scope\": \"global\",\n\t\t\t\"value\": 0\n\t\t}\n\t]\n\t\n}\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would still be good to use text block to improve the readability.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll see what I can do.

I think I actually got it in this form from the tests or something...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The escapes should be dropped.

@kingthorin
Copy link
Member Author

kingthorin commented Feb 24, 2025

Done & done

@kingthorin
Copy link
Member Author

And fixed 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants